#include"pid/pid.h"
struct PID Pid_List[]=
{
    {0,0,0},
};


double PID(double Error,struct PID pid)
{
	double A=0;
	double B=0;
	double C=0;
	double delta=0;
	
	A = (pid.p*(1+1/pid.i+pid.d));
	B = -pid.p*(1+2*pid.d);
	C = pid.p*pid.d;
	
	delta = A*Error + B*pid.ep1 + C*pid.ep2;
	pid.mend += delta;
	
	pid.ep2 = pid.ep1;
	pid.ep1 = Error;
	
	return pid.mend;
}
